package com.applet.applet_shangcheng.controller;

import com.applet.applet_shangcheng.utlis.Result;
import com.applet.applet_shangcheng.utlis.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
//统一异常处理
@ControllerAdvice
@ResponseBody
@CrossOrigin
public class BaseExceptionHandler{

    @ExceptionHandler(value = Exception.class)
    public Result handleException(Exception e){
        e.printStackTrace();
        return new Result(false, StatusCode.ERROR, e.getMessage());
    }
}